package com.sm.dao;

import java.util.List;

import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import org.springframework.stereotype.Repository;

import com.sm.model.Student;

@Repository("iStudentDao")
public interface IStudentDao {

	@Insert("insert into student(name,sex,age,stel,sdept,saddress) values(#{name},#{sex},#{age},#{stel},#{sdept},#{sAddress})")
	public void addStudent(Student student);
	
	/**
	 * 此处一定要和数据库的字段对应
	 * @return
	 */
	@Select("select * from student")
	public List<Student> selectStudent();
	
	@Delete("delete from student where sid=#{id}")
	public void delete(int id);

	@Select("select * from student where sid=#{id}")
	public Student findStudentById(String id);

	@Update("update student set name=#{name},sex=#{sex},age=#{age},stel=#{stel},sdept=#{sdept},saddress=#{sAddress} where sid=#{sid}")
	public void updateStudent(Student stu);
	
}
